<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <c:set var="ctx" value="${pageContext.request.contextPath }"></c:set>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<title>华阳物流管理平台</title>
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resources/css/bootstrap.min.css"/>	
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resources/css/public.css"/>
	</head>
	<body class="huayang">
		<header class="clearfix">
			<a class="navbar-brand d-inline logo2" href="#"><img src="<%=request.getContextPath()%>/resources/img/logo.png"></a>
			<a class="navbar-brand d-inline logo3" href="#"><img src="<%=request.getContextPath()%>/resources/img/1.png"></a>
		</header>
		<div class="clearfix">
			
		</div>
		<input type="hidden" id="deptid" value="${deptid }">
        <nav class="navbar navbar-expand-lg navbar-light bg-light">
            <!--<a class="navbar-brand" href="#">华阳物流</a>-->
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
              <span class="navbar-toggler-icon"></span>
            </button>

            <div class="collapse navbar-collapse" id="navbarSupportedContent">
           	
              <ul class="navbar-nav mr-auto">
              	<div class="container">       	
            	<div class="row clearfix">
              	<li id="cheng"  class="nav-item active col-xs-6">
                  <a class="nav-link nav1" href="${ctx }/department/chengCity?deptid=${deptid}&&rolename=${role.rolename}"><span></span></a>
                </li>
                <li id="mian" class="nav-item active col-xs-6">
                  <a class="nav-link nav2" href="${ctx }/department/mianCity?deptid=${deptid}&&rolename=${role.rolename}"><span></span></a>
                </li>
                 <li id="mz" class="nav-item active col-xs-6">
                  <a class="nav-link nav6" href="${ctx }/department/mzCity?deptid=${deptid}&&rolename=${role.rolename}"><span></span></a>
                </li>
                <li class="nav-item active col-xs-6">
                  <a class="nav-link nav3" href="${ctx }/after/showAfter?pageNow=1&&deptid=${deptid}&&rolename=${role.rolename}"><span></span></a>
                </li>
                <li class="nav-item active col-xs-6">
                 <a class="nav-link nav4" href="${ctx }/accountlist/selectAccountList?deptid=${deptid}&&rolename=${role.rolename}&deptname=&zhiling=&chexing=&xingming=&jiesuan=&jiashiyuanjs=&fatime1=&fatime2="><span></span></a>
                </li>
                <li class="nav-item active col-xs-6">
                  <a class="nav-link nav5" href="${ctx }/back/guanli?deptid=${deptid}&&rolename=${role.rolename}"><span></span></a>
                </li>
               </div>
              </div>
              </ul>
            <div class="clearfix"></div>
            <ul class="nav justify-content-center fixed-top align-middle clearfix ">
			  <li class="nav-item">
                <img class="user-img rounded-circle" src="<%=request.getContextPath()%>/resources/img/raw_1514434504.jpg"/>  
              </li>
              <li class="nav-item user-info">
                <span>${user.uname}</span>    
                <span>${role.rolename}</span> <input type="hidden" id="roleid" value="${role.roleid }">
              </li>
              <li class="nav-item pwd-change">
                <a class="nav-link active align-text-bottom" href="${ctx }/tuser/pwdjsp?deptid=${deptid}">修改密码</a>                
              </li>
              <li class="nav-item exit"> 
              	<a href="${ctx }/back/userLoginOut" onclick="return confirm('您确定要退出系统吗？');" class="nav-link active"><span class="px-3">
					<img src="<%=request.getContextPath()%>/resources/img/exit.png"></span>退出</a>     
              </li>
            </ul>
          </div>       
        </nav>	
        <div class="container-fluid content">
        	<div class="row">
        		<div class="page_position d-none d-sm-block">
        			<!--位置-->
        			<!--<div class="container-fluid pl-5">
        				<div class="row pt-3">
        					<a href="#">绵阳</a>>><a href="#">运单状态</a>
        				</div>
        			</div>-->
        		</div>
        			<div class="container-fluid pl-4 ">
        				<div class="row pt-xl-4 pl-4 py-3 clearfix">
        					<div class="title text-center float-left">
		                	<a href="${ctx }/waybills/insertWaybill?deptid=${deptid}" class="btn btn-block"><span>运单登记</span></a>
		                	</div>
		             
			                <div class="title text-center float-left pl-3">
			                	<a id="export" onclick="method5(val)" href="#" class="btn btn-block"><span>打印运单</span></a>
			                </div>
			                <div style="padding-left:10px;">
        					<form action="${ctx }/waybills/showWaybill?deptid=${deptid}"  method="post" class="form-inline my-2 my-lg-0 float-right pr-4 form-search">
	                          <input name="souVin" id="souVin" class="form-control mr-sm-2" type="search" placeholder="输入车架号" aria-label="Search">
	                          <button class="btn btn-search my-2 my-sm-0" type="submit"><img src="<%=request.getContextPath()%>/resources/img/search_32px_1187523_easyicon.net.png"/></button>
	                        </form>
        				</div>
        				</div>
        				
        				<div class="row pt-xl-4 col-12 col-sm-12 col-lg-9 col-xl-10" >
		                <div id="printDIV" class="col-md-12 column table-content table-responsive">
							<form id="frm" action="${ctx }/accountlist/selectAccountSingle">
		                	<button id = "sub1" type="button">已送达</button>
		                	<table id="val" class="table text-center table-hover" style="min-width: 1700px;overflow: scroll;">
		                		<thead>
		                			<tr class="table-bordered">
						                <th >
							                <input id="qxqx" type="button" value="全选">
						                </th>
						                <th >
							                ID
						                </th>
						                <th style="min-width:85px;">
							                                始发地
						                </th>
						                <th style="min-width:85px;">
							                                目的地
						                </th>
						                <th style="min-width:85px;">
							                                指令号
						                </th>
						                <th style="min-width:85px;">
							                                车架号
						                </th>
						                <th style="min-width:70px;">
							                                车型
						                </th>
						                <th style="min-width:70px;">
							                                驱数
						                </th>
						                <th style="min-width:85px;">
							                                发车时间
						                </th>
						                <th style="min-width:110px;">
							                                预计到达时间
						                </th>
						                <th style="min-width:110px;">
							                              临牌到达时间
						                </th>
						                <th style="min-width:110px;">
							                              保险到达时间
						                </th>
						                <th style="min-width:100px;">
							                              运送驾驶员
						                </th>			             
						                <th style="min-width:85px;">
							                              事故状态
						                </th>
						                <th style="min-width:85px;">
							                              送达状态
						                </th>
						                <th style="min-width:85px;">
							                              所属部门
						                </th>
						                <th style="min-width:60px;">
							                              创建时间
						                </th>
						                <th style="min-width:60px;">
							                              备注
						                </th>
						                <th class="bianTd" style="min-width:85px;">
							                              操作
						                </th>
						                
					                </tr>
				                </thead>
				                <tbody>
					               <c:forEach var="way" items="${waybillVo }">	
					                <tr align="center" valign="middle">
					                	<input type="hidden" name="deptid" value="${way.deptid }">
					                	<input type="hidden" name="rolename" value="${role.rolename}">
					                	<input type="hidden" name="pageNow" value="${page.pageNow }">
						                <td>
							                <input type="checkbox" name="checkbox" value="${way.wayid }">
						                </td>
						                <td>
							                 ${way.wayid }
						                </td>
						                <td>
							                                ${way.comCity }
						                </td>
						                <td>
							                               ${way.bournCity }
						                </td>
						                <td>
							                                   ${way.wInstruct }
						                </td>
						                <td>
							                                   ${way.vehicle }
						                </td>
						                <td>
							                              ${way.vin}
						                </td>
						                <td>
							                 ${way.actuate }
						                </td>
						               <td width="130">
							                <fmt:formatDate value="${way.comDate }" pattern="yyyy-MM-dd     HH"/>
						                </td>
						                <td width="130">
							                <fmt:formatDate value="${way.yujiDate }" pattern="yyyy-MM-dd     HH"/>
						                </td>
						                <td width="130">
							               <fmt:formatDate value="${way.nearDate }" pattern="yyyy-MM-dd     HH"/>
						                </td>
						                <td width="130">
							                <fmt:formatDate value="${way.insuranceDate }" pattern="yyyy-MM-dd     HH"/>
						                </td>
						                <td>
							              ${way.transport }
						                </td>
						                
						                <td>
							                <c:if test="${way.stateAcc== null && way.delivery == null}">
						                		 <button type="button" onclick="window.location.href='${ctx }/accident/insertAccident?wayidSingle=${way.wayid }&deptid=${deptid}&pageNow=${page.pageNow }'">已发生</button>
						                	</c:if>
						                	 <c:if test="${way.stateAcc != null}">
						                	 	${way.stateAcc}
						                	</c:if>
						                </td>
						                <td>
							                 <c:if test="${way.stateAcc== null && way.delivery == null}">
						                	 	<button type="button" onclick="window.location.href='${ctx }/accountlist/selectAccountSingle?wayidSingle=${way.wayid }&deptid=${deptid}&rolename=${role.rolename}&pageNow=${page.pageNow }'">已送达</button>
						                	</c:if>
						                	<c:if test="${way.delivery != null }">
						                		${way.delivery }
						                	</c:if>
						                </td>
						                <td>
							                ${way.deptName }
						                </td>
						                <td width="100">
							               <fmt:formatDate value="${way.creatDate }" pattern="yyyy-MM-dd     HH"/>
						                </td>
						                <td style="width:100px;height:60px !important;">
						                	<div class="" style="width:100px; height: 60px; overflow-y: auto;">
						                		${way.remark }
						                	</div>
							               
						                </td>
						                <td class="bianTd">
						                	<div class="text-center operation">
						                		<a href="${ctx }/waybills/upWayJsp?deptid=${deptid}&&wid=${way.wayid}" >
                                                   <span class="glyphicon glyphicon-pencil">
                                                   	修改
                                                   </span> 
                                                </a>
                                                /
                                                <a href="${ctx }/waybills/delWayById?deptid=${deptid}&&wid=${way.wayid}" onclick="del()">
                                                    <span class="glyphicon glyphicon-remove">
                                                    	删除
                                                    </span>
                                            	</a>
						                	</div>
						                </td>
						                
					                </tr>
					                </c:forEach>
				                </tbody>
			                </table>
		                </form>
		                </div>

        				</div>
        				<div class="row pt-xl-4  col-12 col-sm-10 clearfix">
        				<div class="col-md-12 column table-content table-responsive pagination-block">
		                <div class="col-md-4 column col-center-block text-center">
		                	<ul class="pagination">
	                             <li><a href="${ctx }/waybills/showWaybill?deptid=${deptid}&pageNow=1">首页</a></li>
		                           
		                            <li>
		                            	<c:if test="${page.pageNow >1 && page.pageNow < page.totalPageCount+1 }">
		                            		
		                            		<a href="${ctx }/waybills/showWaybill?deptid=${deptid}&pageNow=${page.pageNow - 1}">上一页</a>
		                            	</c:if>
		                            </li>
		                            <li>
		                            	<c:if test="${page.pageNow >=1 && page.pageNow < page.totalPageCount }">
		                            		<a href="${ctx }/waybills/showWaybill?deptid=${deptid}&pageNow=${page.pageNow + 1}">下一页</a>
		                            	</c:if>
		                            </li>
		                            <li><a href="${ctx }/waybills/showWaybill?deptid=${deptid}&pageNow=${page.totalPageCount}">末页</a></li>
		                            <li><a>共${page.totalPageCount}页${page.totalCount}条</a>到<input id="tzBtn" type="button" value="跳转" style="float:right;"><input id="tzText" type="number" min="1" max="${page.totalPageCount}" value="${page.pageNow }"  style="width:60px;float:right;"/></li>
                            </ul>
		                </div>
		                </div>
        				</div>
        			</div>
        		</div>
        	</div> 
		<script src="<%=request.getContextPath()%>/resources/js/jquery.slim.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="<%=request.getContextPath()%>/resources/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=request.getContextPath()%>/resources/js/jquery-1.7.min.js" type="text/javascript" charset="utf-8"></script>
        	<!--推送消息-->
        	
        		<jsp:include page="munetab.jsp" />
        	
	</body>
	<script type="text/javascript">
		$(document).ready(function(){ 
				  var deptid = document.getElementById("deptid").value;
					if(deptid==1){
						$("#cheng").addClass("current"); 
					 
					}
					if(deptid==2){
						
					   $("#mian").addClass("current"); 
					 
					}
					if(deptid==4){
						
					   $("#mz").addClass("current"); 
					 
					}
			}); 
			
			
			
			$(function(){
	         	var roleid = $("#roleid").val();
				if(roleid != 1){
					$(".bianTd").hide();//非管理员隐藏操作
				}
	         });
	</script>
	<script type="text/javascript">
		function del(){
			if (!confirm("确认要删除？")) {   
            	window.event.returnValue = false;   
       	 	}   
			
		}
	
	</script>
	<script type="text/javascript">
		$("#qxqx").click(function(){
			if($("#qxqx").attr("value")=="全选"){
				$("input[name='checkbox']").attr("checked","true");
				$("#qxqx").attr("value","取消");
			}else{
				$("input[name='checkbox']").removeAttr("checked"); 
				$("#qxqx").attr("value","全选");
			}
		})
		$("#sub1").click(function(){
			var sl = $("input[name='checkbox']:checked").length;
			if(sl>0){
				$("#frm").submit();
			}else{
				alert("请至少选择一条数据");
			}
		})
		$("#tzBtn").click(function(){
			var p = $("#tzText").val();
			if(p>${page.totalPageCount}){
				alert("请输入正确页码");
			}else{
				window.location.href="${ctx }/waybills/showWaybill?deptid=${deptid}&pageNow="+p;
			}
		})
	</script>
	<script type="text/javascript" language="javascript">
	function method5(tableid) {
		var str = document.getElementById("printDIV").innerHTML;
		var printWin=window.open("打印窗口", "_blank");
		printWin.document.write(str );
		printWin.document.close();
		printWin.print();
		printWin.close();
		}
		</script> 
		<script type="text/javascript"> 
		   window.onload=function(){ 
				var action ='<%=request.getAttribute("result")%>';
				if(action.length!==4)
				{
					alert(action);
				}
			} 
		</script>
		
		
		
</html>
